package com.moyuxi.sound_of_the_forest.ui.pages.musicClassify

import androidx.compose.runtime.Composable
import com.moyuxi.sound_of_the_forest.entity.LocalMusicBean
import com.moyuxi.sound_of_the_forest.ui.compose.AlbumOrArtistListCompose

@Composable
fun AlbumListFrameCompose(
    data:List<LocalMusicBean>,
    navToScanMusic: () -> Unit,
    navToAlbumOrArtis: (LocalMusicBean,List<LocalMusicBean>) -> Unit
) {//中间列表内容
    val albumMap: MutableMap<String, MutableList<LocalMusicBean>> = mutableMapOf()
    data.forEach {
        if (albumMap.containsKey(it.album)) {
            val songList = albumMap.getValue(it.album)
            songList.add(songList.size, it)
        } else albumMap[it.album] = mutableListOf(it)
    }
    AlbumOrArtistListCompose(navToScanMusic, albumMap, navToAlbumOrArtis)
}
